package com.ct.entity.po;

import java.io.Serializable;
import java.util.Date;

import lombok.Builder;
import org.springframework.format.annotation.DateTimeFormat;

import com.ct.entity.enums.DateTimePatternEnum;
import com.ct.utils.DateUtil;
import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 行程表
 */
@Builder
public class Schedule implements Serializable {

    /**
     * 行程编号
     */
    private Integer scheduleId;

    /**
     * 行程地点
     */
    private String location;

    /**
     * 行程任务
     */
    private String task;

    /**
     * 行程详情
     */
    private String scheduleDetail;

    /**
     * 开始日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date startDate;

    /**
     * 结束日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endTime;

    /**
     * 出差编号
     */
    private Integer travelId;

    public Schedule() {
    }

    public Schedule(Integer scheduleId, String location, String task, String scheduleDetail, Date startDate,
            Date endTime, Integer travelId) {
        this.scheduleId = scheduleId;
        this.location = location;
        this.task = task;
        this.scheduleDetail = scheduleDetail;
        this.startDate = startDate;
        this.endTime = endTime;
        this.travelId = travelId;
    }

    public void setScheduleId(Integer scheduleId) {
        this.scheduleId = scheduleId;
    }

    public Integer getScheduleId() {
        return this.scheduleId;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public String getLocation() {
        return this.location;
    }

    public void setTask(String task) {
        this.task = task;
    }

    public String getTask() {
        return this.task;
    }

    public void setScheduleDetail(String scheduleDetail) {
        this.scheduleDetail = scheduleDetail;
    }

    public String getScheduleDetail() {
        return this.scheduleDetail;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getStartDate() {
        return this.startDate;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public Date getEndTime() {
        return this.endTime;
    }

    public void setTravelId(Integer travelId) {
        this.travelId = travelId;
    }

    public Integer getTravelId() {
        return this.travelId;
    }

    @Override
    public String toString() {
        return "行程编号:" + (scheduleId == null ? "空" : scheduleId) + "，行程地点:" + (location == null ? "空" : location)
                + "，行程任务:" + (task == null ? "空" : task) + "，行程详情:" + (scheduleDetail == null ? "空" : scheduleDetail)
                + "，开始日期:"
                + (startDate == null ? "空" : DateUtil.format(startDate, DateTimePatternEnum.YYYY_MM_DD.getPattern()))
                + "，结束日期:"
                + (endTime == null ? "空" : DateUtil.format(endTime, DateTimePatternEnum.YYYY_MM_DD.getPattern()))
                + "， 出差编号:" + (travelId == null ? "空" : travelId);
    }
    public static ScheduleBuilder builder() {
        return new ScheduleBuilder();
    }

    public static class ScheduleBuilder {
        private Integer scheduleId;
        private String location;
        private String task;
        private String scheduleDetail;
        private Date startDate;
        private Date endTime;
        private Integer travelId;

        ScheduleBuilder() {
        }

        public ScheduleBuilder scheduleId(Integer scheduleId) {
            this.scheduleId = scheduleId;
            return this;
        }

        public ScheduleBuilder location(String location) {
            this.location = location;
            return this;
        }

        public ScheduleBuilder task(String task) {
            this.task = task;
            return this;
        }

        public ScheduleBuilder scheduleDetail(String scheduleDetail) {
            this.scheduleDetail = scheduleDetail;
            return this;
        }

        @JsonFormat(
                pattern = "yyyy-MM-dd",
                timezone = "GMT+8"
        )
        public ScheduleBuilder startDate(Date startDate) {
            this.startDate = startDate;
            return this;
        }

        @JsonFormat(
                pattern = "yyyy-MM-dd",
                timezone = "GMT+8"
        )
        public ScheduleBuilder endTime(Date endTime) {
            this.endTime = endTime;
            return this;
        }

        public ScheduleBuilder travelId(Integer travelId) {
            this.travelId = travelId;
            return this;
        }

        public Schedule build() {
            return new Schedule(this.scheduleId, this.location, this.task, this.scheduleDetail, this.startDate, this.endTime, this.travelId);
        }

        public String toString() {
            return "Schedule.ScheduleBuilder(scheduleId=" + this.scheduleId + ", location=" + this.location + ", task=" + this.task + ", scheduleDetail=" + this.scheduleDetail + ", startDate=" + this.startDate + ", endTime=" + this.endTime + ", travelId=" + this.travelId + ")";
        }
    }
}
